home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / libs / intoids.lha / Intoids 1.0 / Source / Test.c < prev    next >
C/C++ Source or Header  |  1997-02-12  |  18KB  |  519 lines

  1. /* A little program for testing the Intoids.library.  By AGMS. */
  2. /* $Header: Big:Programming/C/Intoids/Test/RCS/Test.c,v 1.8 1997/02/12 17:58:24 AGMS Exp $ */
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>  /* For atexit */
  6. #include <string.h>
  7. #include <proto/exec.h>
  8. #include <proto/Intoids.h>
  9.  
  10. struct Library *IntoidsBase;
  11.  
  12.  
  13.  
  14. /******************************************************************************
  15.  * Prints the binary representation of an Intoid.
  16.  */
  17.  
  18. void DumpIntoid (Intoid IntegerA)
  19. {
  20.   typedef struct IntRepStruct
  21.   {
  22.     unsigned short  currentLength;    /* Number of entries in numberArray. */
  23.     BOOL            positiveSign;     /* 1 means >= 0; 0 means < 0. */
  24.     unsigned short  allocatedLength;  /* 0 means static.  Number of shorts. */
  25.     unsigned short  numberArray [1];  /* least significant value in [0]. */
  26.   } IntRep, *IntRepPointer;
  27.  
  28.   int           i;
  29.   IntRepPointer MyIntRep;
  30.  
  31.   if ((long) IntegerA & 1) /* A small int */
  32.     printf ("%lX:%ld", (long) IntegerA, ((long) IntegerA) >> 1);
  33.   else if (IntegerA == 0) /* Not a number, null number. */
  34.     printf ("NAN");
  35.   else if ((((long) IntegerA) & 3) == 0) /* A pointer to Intrep. */
  36.   {
  37.     MyIntRep = (IntRepPointer) IntegerA;
  38.     printf ("%08lX->%d/%d%c",(long) MyIntRep,
  39.     (int) MyIntRep->currentLength, (int) MyIntRep->allocatedLength,
  40.     MyIntRep->positiveSign ? '+' : '-');
  41.     for (i = MyIntRep->currentLength - 1; i >= 0; --i)
  42.       printf ("%04X", (int) MyIntRep->numberArray[i]);
  43.     for (i = MyIntRep->currentLength; i < MyIntRep->allocatedLength; i++)
  44.       if (MyIntRep->numberArray[i] != 0)
  45.       {
  46.         printf ("\n**** BUG: Non-zero word in unused but allocated part. ****\n");
  47.         break;
  48.       }
  49.   }
  50.   else /* A special code. */
  51.     printf ("SC%d", (int) (((long) IntegerA) >> 2));
  52. }
  53.  
  54.  
  55.  
  56. /******************************************************************************
  57.  * Converts the string to an Intoid, a long, a string and portable number
  58.  * format and converts it back to see if it got it right.
  59.  */
  60.  
  61. void TestConversions (char *InputString)
  62. {
  63.   Intoid  IntoidA;
  64.   Intoid  IntoidB;
  65.   long    BufferNeeded;
  66.   ULONG   ByteCount;
  67.   char    MyBuffer[80];
  68.   long    NewLong;
  69.   char   *NextLetter;
  70.  
  71.   /* String conversion tests. */
  72.  
  73.   IntoidA = AsciiToIntoid (InputString, &NextLetter,
  74.   0 /* default base */, NULL);
  75.  
  76.   BufferNeeded = IntoidToAscii (IntoidA, MyBuffer, sizeof (MyBuffer), 10);
  77.   printf ("Input \"%s\" becomes \"%s\", leftover \"%s\"\n",
  78.   InputString ? InputString : "NULL",
  79.   MyBuffer,
  80.   NextLetter ? NextLetter : "NULL");
  81.   printf ("intoid representation is ");
  82.   DumpIntoid (IntoidA);
  83.   printf ("\n");
  84.  
  85.   if (BufferNeeded != strlen (MyBuffer) + 1)
  86.     printf ("**** BUG: IntoidToAscii returns %ld, not %ld. ****\n",
  87.     BufferNeeded, (long) strlen (MyBuffer) + 1);
  88.  
  89.   if (InputString != NULL)
  90.     BufferNeeded = strlen (InputString);
  91.   else
  92.     BufferNeeded = 0;
  93.   if (NextLetter < InputString || NextLetter > InputString + BufferNeeded)
  94.     printf ("**** BUG: AsciiToIntoid next letter out of range. ****\n");
  95.  
  96.   IntoidB = AsciiToIntoid (MyBuffer, NULL, 10, NULL);
  97.  
  98.   if (CompareIntoids (IntoidA, IntoidB) != 0)
  99.     printf ("**** BUG: AsciiToIntoid and back didn't work. ****\n");
  100.  
  101.   /* Long conversion tests. */
  102.  
  103.   NewLong = IntoidToLong (IntoidA);
  104.   printf ("as a long $%lX (%ld)\n", NewLong, NewLong);
  105.  
  106.   IntoidB = LongToIntoid (NewLong, IntoidB);
  107.   if (CompareIntoids (IntoidA, IntoidB) != 0)
  108.     printf ("**** BUG: Intoid<->Long conversion didn't work. ****\n");
  109.  
  110.   if (!IntoidFitsInLong (IntoidB))
  111.     printf ("**** BUG: Claims %ld doesn't fit in a long after conversion! ****\n",
  112.     NewLong);
  113.  
  114.   /* Portable integer tests. */
  115.  
  116.   if (!IntoidToPortableIntViaBuffer (IntoidA, &ByteCount, MyBuffer, sizeof (MyBuffer)))
  117.     printf ("**** BUG: Can't convert to a portable integer. ****\n");
  118.  
  119.   printf ("portable int format is %ld bytes:", ByteCount);
  120.   for (NewLong = 0; NewLong < ByteCount; NewLong++)
  121.     printf (" %02X", (int) (UBYTE) MyBuffer [NewLong]);
  122.   printf ("\n");
  123.  
  124.   NewLong = PortableIntSizeOfIntoid (IntoidA);
  125.   if (ByteCount != NewLong)
  126.     printf ("**** BUG: Portable length estimate from Intoid is %ld, not %ld. ****\n",
  127.     NewLong, ByteCount);
  128.  
  129.   NewLong = PortableIntLengthViaBuffer (MyBuffer, sizeof (MyBuffer));
  130.   if (NewLong != ByteCount)
  131.     printf ("**** BUG: Length of portable in buffer is %ld, not %ld. ****\n",
  132.     NewLong, ByteCount);
  133.  
  134.   NewLong = ByteCount;
  135.   IntoidB = PortableIntToIntoidViaBuffer (MyBuffer, sizeof (MyBuffer),
  136.   &ByteCount, IntoidB);
  137.  
  138.   if (ByteCount != NewLong)
  139.     printf ("**** BUG: Portable Int to Intoid length is %ld, not %ld. ****\n",
  140.     ByteCount, NewLong);
  141.  
  142.   if (CompareIntoids (IntoidA, IntoidB) != 0)
  143.     printf ("**** BUG: Portable Integer conversion didn't work. ****\n");
  144.  
  145.   FreeIntoid (IntoidA);
  146.   FreeIntoid (IntoidB);
  147.  
  148.   printf ("\n");
  149. }
  150.  
  151.  
  152.  
  153. /******************************************************************************
  154.  * Test the comparison function, and addition and subtraction.
  155.  */
  156.  
  157. static void TestComparison (char *String1, char *String2)
  158. {
  159.   Intoid  IntegerA;
  160.   Intoid  IntegerB;
  161.   Intoid  IntegerC;
  162.   char    MyBufferA[80];
  163.   char    MyBufferB[80];
  164.   long    Result;
  165.  
  166.   IntegerA = AsciiToIntoid (String1, NULL, 0 /* default base */, NULL);
  167.   IntegerB = AsciiToIntoid (String2, NULL, 0 /* default base */, NULL);
  168.   IntegerC = NULL;
  169.  
  170.   /* Subtraction test. */
  171.  
  172.   IntegerC = SubtractIntoids (IntegerA, IntegerB, IntegerC);
  173.   IntoidToAscii (IntegerC, MyBufferA, sizeof (MyBufferA), 10);
  174.   printf ("%s - %s = %s, ", String1, String2, MyBufferA);
  175.   DumpIntoid (IntegerC);
  176.   printf ("\n");
  177.  
  178.   IntegerC = AddIntoids (IntegerC, IntegerB, IntegerC);
  179.   IntoidToAscii (IntegerC, MyBufferB, sizeof (MyBufferB), 10);
  180.   if (CompareIntoids (IntegerA, IntegerC) != 0)
  181.     printf ("**** BUG: %s - %s + %s = %s, not %s. ****\n",
  182.     String1, String2, String2, MyBufferB, String1);
  183.  
  184.   /* Addition test. */
  185.  
  186.   IntegerC = AddIntoids (IntegerA, IntegerB, IntegerC);
  187.   IntoidToAscii (IntegerC, MyBufferA, sizeof (MyBufferA), 10);
  188.   printf ("%s + %s = %s, ", String1, String2, MyBufferA);
  189.   DumpIntoid (IntegerC);
  190.   printf ("\n");
  191.  
  192.   IntegerC = SubtractIntoids (IntegerC, IntegerA, IntegerC);
  193.   IntoidToAscii (IntegerC, MyBufferB, sizeof (MyBufferB), 10);
  194.   if (CompareIntoids (IntegerB, IntegerC) != 0)
  195.     printf ("**** BUG: %s + %s - %s = %s, not %s. ****\n",
  196.     String1, String2, String1, MyBufferB, String2);
  197.  
  198.   /* Comparison tests. */
  199.  
  200.   Result = CompareIntoids (IntegerA, IntegerB);
  201.   printf ("Signed comparison: %s %c %s\n",
  202.   String1,
  203.   (Result < 0) ? '<' : ((Result == 0) ? '=' : '>'),
  204.   String2);
  205.  
  206.   Result = CompareIntoidMagnitudes (IntegerA, IntegerB);
  207.   printf ("Magnitude comparison: %s %c %s\n",
  208.   String1,
  209.   (Result < 0) ? '<' : ((Result == 0) ? '=' : '>'),
  210.   String2);
  211.  
  212.   FreeIntoid (IntegerA);
  213.   FreeIntoid (IntegerB);
  214.   FreeIntoid (IntegerC);
  215.  
  216.   printf ("\n");
  217. }
  218.  
  219.  
  220.  
  221. /******************************************************************************
  222.  * Test multiplication and division.
  223.  */
  224.  
  225. void TestMultiplication (char *String1, char *String2)
  226. {
  227.   Intoid  IntegerA;
  228.   Intoid  IntegerB;
  229.   Intoid  IntegerC;
  230.   Intoid  IntegerD;
  231.   char    MyBufferA[80];
  232.   char    MyBufferB[80];
  233.  
  234.   IntegerA = AsciiToIntoid (String1, NULL, 0 /* default base */, NULL);
  235.   IntegerB = AsciiToIntoid (String2, NULL, 0 /* default base */, NULL);
  236.  
  237.   IntegerC = MultiplyIntoids (IntegerA, IntegerB, NULL);
  238.   IntegerD = NULL;
  239.  
  240.   IntoidToAscii (IntegerC, MyBufferA, sizeof (MyBufferA), 10);
  241.   printf ("%s * %s = %s, ", String1, String2, MyBufferA);
  242.   DumpIntoid (IntegerC);
  243.   printf ("\n");
  244.  
  245.   if (IntegerA != SmallIntToIntoid (0) && IntegerA != NULL)
  246.   {
  247.     IntegerD = DivideIntoids (IntegerC, IntegerA, IntegerD);
  248.     if (CompareIntoids (IntegerB, IntegerD) != 0)
  249.     {
  250.       IntoidToAscii (IntegerC, MyBufferA, sizeof (MyBufferA), 10);
  251.       IntoidToAscii (IntegerD, MyBufferB, sizeof (MyBufferB), 10);
  252.       printf ("**** BUG: Division of %s by %s gives %s, not %s ****\n",
  253.       MyBufferA, String1, MyBufferB, String2);
  254.     }
  255.   }
  256.  
  257.   if (IntegerB != SmallIntToIntoid (0) && IntegerB != NULL)
  258.   {
  259.     IntegerD = DivideIntoids (IntegerC, IntegerB, IntegerD);
  260.     if (CompareIntoids (IntegerA, IntegerD) != 0)
  261.     {
  262.       IntoidToAscii (IntegerC, MyBufferA, sizeof (MyBufferA), 10);
  263.       IntoidToAscii (IntegerD, MyBufferB, sizeof (MyBufferB), 10);
  264.       printf ("**** BUG: Division of %s by %s gives %s, not %s ****\n",
  265.       MyBufferA, String2, MyBufferB, String1);
  266.     }
  267.   }
  268.  
  269.   /* And now for the division test. */
  270.  
  271.   IntegerC = DivideIntoids (IntegerA, IntegerB, IntegerC);
  272.   if (IntegerC == NULL)
  273.   {
  274.     printf ("Error reported during division: \"%s\"\n",
  275.     GetLastIntoidErrorMessage ());
  276.   }
  277.   IntoidToAscii (IntegerC, MyBufferA, sizeof (MyBufferA), 10);
  278.   printf ("%s / %s = %s, ", String1, String2, MyBufferA);
  279.   DumpIntoid (IntegerC);
  280.   printf ("\n");
  281.  
  282.   if (IntegerC != SmallIntToIntoid (0) && IntegerC != NULL)
  283.   {
  284.     if (SignOfIntoid (IntegerA) * SignOfIntoid (IntegerB) !=
  285.     SignOfIntoid (IntegerC))
  286.       printf ("**** BUG: Result of division has wrong sign. ****\n");
  287.  
  288.     IntegerD = MultiplyIntoids (IntegerC, IntegerB, IntegerD);
  289.     IntegerD = SubtractIntoids (IntegerA, IntegerD, IntegerD);
  290.     IntoidToAscii (IntegerD, MyBufferB, sizeof (MyBufferB), 10);
  291.     if (CompareIntoidMagnitudes (IntegerB, IntegerD) < 0)
  292.       printf ("**** BUG: %s - (%s * %s) is %s, magnitude is bigger than %s. ****\n",
  293.       String1, String2, MyBufferA, MyBufferB, String2);
  294.   }
  295.  
  296.   FreeIntoid (IntegerA);
  297.   FreeIntoid (IntegerB);
  298.   FreeIntoid (IntegerC);
  299.   FreeIntoid (IntegerD);
  300.  
  301.   printf ("\n");
  302. }
  303.  
  304.  
  305.  
  306. /******************************************************************************
  307.  * Test squaring of a number.
  308.  */
  309.  
  310. void TestSquaring (STRPTR String)
  311. {
  312.   Intoid  IntegerA;
  313.   Intoid  IntegerB;
  314.   Intoid  IntegerC;
  315.   char    MyBufferA[80];
  316.   char    MyBufferB[80];
  317.  
  318.   IntegerA = AsciiToIntoid (String, NULL, 0 /* default base */, NULL);
  319.   IntegerB = MultiplyIntoids (IntegerA, IntegerA, NULL);
  320.   IntegerC = CopyIntoid (IntegerB, NULL);
  321.  
  322.   IntoidToAscii (IntegerB, MyBufferA, sizeof (MyBufferA), 10);
  323.   printf ("%s squared = %s, ", String, MyBufferA);
  324.   DumpIntoid (IntegerB);
  325.   printf ("\n");
  326.  
  327.   IntegerB = DivideIntoids (IntegerB, IntegerA, IntegerB);
  328.   if (CompareIntoids (IntegerA, IntegerB) != 0)
  329.   {
  330.     IntoidToAscii (IntegerB, MyBufferB, sizeof (MyBufferB), 10);
  331.     printf ("**** BUG: Division of %s by %s gives %s, not %s ****\n",
  332.     MyBufferA, String, MyBufferB, String);
  333.   }
  334.  
  335.   IntegerA = MultiplyIntoids (IntegerA, IntegerA, IntegerA);
  336.   if (CompareIntoids (IntegerC, IntegerA) != 0)
  337.   {
  338.     IntoidToAscii (IntegerA, MyBufferB, sizeof (MyBufferB), 10);
  339.     printf ("**** BUG: Second squaring technique gives %s, not %s ****\n",
  340.     MyBufferB, MyBufferA);
  341.   }
  342.  
  343.   FreeIntoid (IntegerA);
  344.   FreeIntoid (IntegerB);
  345.   FreeIntoid (IntegerC);
  346.  
  347.   printf ("\n");
  348. }
  349.  
  350.  
  351.  
  352. /******************************************************************************
  353.  * Called when the program exits.  Close library etc.
  354.  */
  355.  
  356. void CleanUp (void)
  357. {
  358.   printf ("Running CleanUp function.\n");
  359.  
  360.   if (IntoidsBase != NULL)
  361.   {
  362.     CloseLibrary (IntoidsBase);
  363.     IntoidsBase = NULL;
  364.     printf ("Closed " IntoidsName "\n");
  365.   }
  366. }
  367.  
  368.  
  369.  
  370. /******************************************************************************
  371.  * The main program.  Open library, do tests, close library.
  372.  */
  373.  
  374. int main (void)
  375. {
  376.   STRPTR      Credits;
  377.   STRPTR      Infinity;
  378.   char        MinusInfinity [80];
  379.   STRPTR      NotANumber;
  380.  
  381.   atexit (CleanUp);
  382.  
  383.   IntoidsBase = OpenLibrary (IntoidsName, 0);
  384.   if (IntoidsBase == NULL)
  385.   {
  386.     printf ("Sorry, unable to open " IntoidsName ".\n");
  387.     return 20;
  388.   }
  389.  
  390.   NotANumber = GetIntoidsMessage (MSG_INTOIDS_NOT_A_NUMBER);
  391.   Infinity = GetIntoidsMessage (MSG_INTOIDS_INFINITY);
  392.   strcpy (MinusInfinity + 1, Infinity);
  393.   MinusInfinity[0] = '-';
  394.  
  395.   printf ("Here are the Intoids.library credits:\n");
  396.  
  397.   GetLastIntoidErrorMessage ();  /* Reset the error message to credits. */
  398.   Credits = GetLastIntoidErrorMessage ();
  399.   printf (Credits);
  400.  
  401.  
  402.   TestConversions ("0");
  403.   TestConversions ("-1L");
  404.   TestConversions ("1 This is after.");
  405.   TestConversions ("-0x7FFFFFFF");
  406.   TestConversions ("-0x80000000");
  407.   TestConversions ("-0x80000001");
  408.   TestConversions ("+0x7FFFFFFF");
  409.   TestConversions ("+0x80000000");
  410.   TestConversions ("+0x80000001");
  411.   TestConversions ("0x3FFFFFFF");
  412.   TestConversions ("0x40000000");
  413.   TestConversions ("-0x3FFFFFFF");
  414.   TestConversions ("-0x40000000");
  415.   TestConversions ("-0x40000001");
  416.   TestConversions ("0xBFFFFFFF");
  417.   TestConversions ("0xFFFE");
  418.   TestConversions ("0xFFFF");
  419.   TestConversions ("-0xFFFF");
  420.   TestConversions ("0x10000");
  421.   TestConversions ("-0x10000");
  422.   TestConversions ("127");
  423.   TestConversions ("128");
  424.   TestConversions ("129");
  425.   TestConversions ("254");
  426.   TestConversions ("255");
  427.   TestConversions ("256");
  428.   TestConversions ("-105");
  429.   TestConversions ("-106");
  430.   TestConversions ("-107");
  431.   TestConversions ("-127");
  432.   TestConversions ("-128");
  433.   TestConversions ("-129");
  434.   TestConversions ("-254");
  435.   TestConversions ("-255");
  436.   TestConversions ("-256");
  437.   TestConversions ("The next one will be a NULL pointer.");
  438.   TestConversions (NULL);
  439.   TestConversions ("100000");
  440.   TestConversions ("-100000");
  441.   TestConversions (" 1000000000000Space in front.");
  442.   TestConversions ("\t-1000000000000Tab in front.");
  443.   TestConversions ("\t 0x80000000Tab and space.");
  444.   TestConversions ("0xc0000000");
  445.   TestConversions ("00000000000000000000000000000000000000000100Lots of leading zeroes, base 8.");
  446.   TestConversions (Infinity);
  447.   TestConversions (MinusInfinity);
  448.   TestConversions (NotANumber);
  449.   TestConversions ("0x1122334455667788");
  450.   TestConversions ("-0x112233445566778899");
  451.   TestConversions ("-0x11223344556677889900");
  452.   TestConversions ("-123456 Next we have 254, 255 and 256 byte long numbers.");
  453.   TestConversions ("0x112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEE");
  454.   TestConversions ("0x112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF");
  455.   TestConversions ("0x112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00");
  456.  
  457.   TestComparison ("0", "0");
  458.   TestComparison ("10", "8");
  459.   TestComparison ("10", "10");
  460.   TestComparison ("10", "11");
  461.   TestComparison ("10", "12345678901234567890");
  462.   TestComparison ("10", "-12345678901234567890");
  463.   TestComparison ("-10", "12345678901234567890");
  464.   TestComparison ("-10", "-12345678901234567890");
  465.   TestComparison ("1000000000000000000", "1000000000000000000");
  466.   TestComparison ("1000000000000000000", "1000000000000000007");
  467.   TestComparison ("1000000000000000007", "1000000000000000000");
  468.   TestComparison ("-1000000000000000000", "1000000000000000000");
  469.   TestComparison ("1000000000000000000", "-1000000000000000000");
  470.   TestComparison ("-1000000000000000000", "-1000000000000000000");
  471.   TestComparison ("-1000000000000000007", "-1000000000000000000");
  472.   TestComparison ("-1000000000000000000", "-1000000000000000007");
  473.   TestComparison ("-10", Infinity);
  474.   TestComparison ("10", Infinity);
  475.   TestComparison ("-10", MinusInfinity);
  476.   TestComparison ("10", MinusInfinity);
  477.   TestComparison ("146237845623784678320", Infinity);
  478.   TestComparison (MinusInfinity, Infinity);
  479.   TestComparison (Infinity, MinusInfinity);
  480.   TestComparison (Infinity, Infinity);
  481.   TestComparison (MinusInfinity, MinusInfinity);
  482.   TestComparison ("0xFFFF", "1");
  483.   TestComparison ("0xFFFFFFFF", "1");
  484.   TestComparison ("0xFFFFFFFFFFFF", "1");
  485.   TestComparison ("0xFFFFFFFFFFFF", "0xFFFFFFFFFFFF");
  486.   TestComparison ("0xFFFFFFFFFFFFFFFFFFFFFFFF", "1");
  487.  
  488.   TestMultiplication ("0", "0");
  489.   TestMultiplication ("1", "0");
  490.   TestMultiplication ("-1", "0");
  491.   TestMultiplication ("1", "0x123456789ABCDEF");
  492.   TestMultiplication ("-0x100000000", "-0x123456789ABCDEF");
  493.   TestMultiplication ("0x123456789ABCDEF", "0");
  494.   TestMultiplication ("0x123456789ABCDEF", "1");
  495.   TestMultiplication ("0x123456789ABCDEF", "2");
  496.   TestMultiplication ("12345678900", "100");
  497.   TestMultiplication ("100", "12345678900");
  498.   TestMultiplication ("123456789999", "-10000000000");
  499.   TestMultiplication ("-10000000000", "123456789999");
  500.   TestMultiplication ("123456789999", MinusInfinity);
  501.   TestMultiplication (MinusInfinity, "123456789999");
  502.   TestMultiplication (MinusInfinity, "+infinity");
  503.   TestMultiplication ("0", MinusInfinity);
  504.   TestMultiplication ("nan", "42");
  505.   TestMultiplication ("12345678901234567890", "nAn");
  506.   TestMultiplication ("-0x400000000", "16");
  507.  
  508.   TestSquaring ("0");
  509.   TestSquaring ("1");
  510.   TestSquaring ("-1");
  511.   TestSquaring ("42");
  512.   TestSquaring ("-1000000");
  513.   TestSquaring ("-10000000000");
  514.   TestSquaring (MinusInfinity);
  515.   TestSquaring (NotANumber);
  516.  
  517.   printf ("\nThe end.\n");
  518. }
  519.